package com.lxj.student_security.mapper;

import com.lxj.student_security.entity.Permission;
import com.lxj.student_security.entity.Role;
import com.lxj.student_security.entity.RolePermission;
import com.lxj.student_security.entity.vo.RolePermissionRelation;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RoleMapper {
    List<Role> findAll(Role role);

    int delete(Integer[] id);

    int edit(Role role);

    int add(Role role);

    int addPs(RolePermission rolePermission);

    Role findById(Integer id);

    List<RolePermissionRelation> findByRoleId(Integer id);

    /**
     * 参数前面加@Param 在mybatis好区分循环的是哪一个参数 然后写循环插入数据的sql语句
     * @param ids
     * @param id
     * @return
     */
    int addPermission(@Param("ids") Integer[] ids,@Param("id") Integer id);

    int deletePermission(@Param("ids") Integer[] ids,@Param("id") Integer id);

    Role searchById(Integer id);

    List<Permission> findPermission(Integer id);

    List<Role> searchAll();
}
